﻿#ifndef USERMANAGETABLEVIEW_H
#define USERMANAGETABLEVIEW_H

#include "mytableview.h"
#include "userrelation.h"
#include "usermanagestandarditemmodel.h"

class UserManageTableView : public MyTableView
{
    Q_OBJECT
public:
    explicit UserManageTableView(QWidget *parent = nullptr);

    void setWidgetType(UserRelation::RelationType widgetType);

    void initHiddenState();

    void setListPushButton(ListPushButton *listPushButton);

    void insertUserRelation(QList<UserRelation*> relations, bool isShowPlatformUser);

    void queryUserRelation(
            bool isShowPlatformUser,
            QString overallQuery,
            QString nickNameQuery,
            QString contactQuery,
            QString telQuery,
            QString primaryQuery,
            QString secondaryQuery);

    void clear();

    UserRelation* currentUserRelation();

    void loadUserRelations(bool isShowPlatformUser);

signals:
    void refreshUserRelationData(
            double totalTicketIn,
            double totalTicketOut,
            double totalMoneyIn,
            double totalMoneyOut);

public slots:

private:
    UserManageStandardItemModel *model;
    UserRelation::RelationType widgetType;

private:
    double totalTicketIn;
    double totalTicketOut;
    double totalMoneyIn;
    double totalMoneyOut;
};

#endif // USERMANAGETABLEVIEW_H
